<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <!-- 对象的访问和操作 -->
  <script>
    var car = {
      name: "奥拓",
      color: "白色",
      pai: "5.8T",
      1.88: "百公里加速 5.8s",
      run: function (params) {
        console.log(params + "跑")
      }
    }
    // 对象属性的访问
    console.log(car.name)
    console.log(car["color"])
    var pl = "pai"
    // 变量代替key值 需要用[]访问
    console.log(car[pl])
    //key值是number 必须用[]访问
    console.log(car[1.88])

    // 对象的遍历  for in
    for (var x in car) {
      // x代表key 
      console.log(car[x])
    }
    //调用函数
    car.run("哈哈哈")
    car["run"]()
    //对象的删除属性  delete 
    delete car.color
    console.log(car)
    // 给对象添加属性
    car.lun = 4;

  </script>
</body>

</html>